package eightDataType;

import org.junit.Test;

import java.util.Random;

/**
 * @Author: Jie
 * @Date: 2019/3/25 10:12
 * @Function :二进制 dmeo
 */
public class BinaryDemo {

    @Test
    public void test() {
        int read = 0b101;
        System.out.println((read&1)==1);

        int num2 = 0b110;
        System.out.println(num2&0b10);
    }

    public static void main(String[] args) {
        int interestOps = 0;
        int read = 0b001;
        int write = 0b100;
        interestOps = read;
        System.out.println("read == "+((interestOps & read)==read));
        interestOps = (write | read);
//        0b101;
//        0b100;
//        0b100;
        System.out.println(interestOps);
        System.out.println("write == "+((interestOps & write)));
        System.out.println("write == "+((interestOps & write)==write));

        Random random = new Random();
        System.out.println(Integer.MAX_VALUE+"  min=="+Integer.MIN_VALUE);
        System.out.println(0xff000000);
        System.out.println(0xf00000);
        System.out.println(0xf000000);
        System.out.println(0xa0000000);
        System.out.println(0xb0000000);
        System.out.println(0xc0000000);
        System.out.println(0xf0000000);
//        for (int i = 0; i < 100; i++) {
//            int i1 = random.nextInt(0x00ffffff);
//            System.out.println(" 无透明色==  "+ (0xff000000 | i1)+"  随机数  " + i1);
//        }


    }
}
